package com.example.goods.servcie;


import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Random;

/**
 * @author: mtl
 * @Date: 2022/1/17 18:38
 * @Description:
 */
public class demo {

    public static void main(String[] args) throws InterruptedException, IOException {

        System.out.println(getRandomChar(10));

    }

    private static String getRandomChar(Integer size) {
        StringBuilder strs = new StringBuilder();
        for(int i = 0; i < size; i++){
            String str = "";
            int hightPos; //
            int lowPos;
            Random random = new Random();
            hightPos = (176 + Math.abs(random.nextInt(39)));
            lowPos = (161 + Math.abs(random.nextInt(93)));
            byte[] b = new byte[2];
            b[0] = (Integer.valueOf(hightPos)).byteValue();
            b[1] = (Integer.valueOf(lowPos)).byteValue();
            try {
                str = new String(b, "GBK");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
                System.out.println("错误");
            }
            strs.append(str);
        }
    return strs.toString();
  }


}
